#!/bin/bash

## Description: create local development directory
## Usage: localdev
## Example: ddev localdev <git-url>

if [ ! -d ".localdev/" ]
then
     mkdir ".localdev/"
     echo "Directory created."
fi

if ! grep -q "./.localdev/*" composer.json; then
  php vendor/bin/composer config repositories.local '{"type": "path", "url": "./.localdev/*", "canonical": false}'
  echo "Patched composer.json."
fi

cd ".localdev/" || exit
git clone "$@"
